package org.Iter2.Presentacion;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.ImageIcon;

import java.awt.GridBagLayout;

import javax.swing.JButton;

import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Component;

import javax.swing.Box;
import javax.swing.UIManager;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class VentanaPrincipal extends JFrame {

	private JPanel contentPane;
	private final JPanel pnlLogoPrincipal = new JPanel();
	private final JLabel lblLogoPrincipal = new JLabel("");
	private final JPanel pnlSecciones = new JPanel();
	protected final JButton btbBC = new JButton("");
	private final JButton btbD = new JButton("");
	private final JButton btbGestionarUsuarios = new JButton("Gestionar Usuarios");
	private final Component horizontalStrut = Box.createHorizontalStrut(20);
	private final Component verticalStrut = Box.createVerticalStrut(20);
	private final Component horizontalStrut_1 = Box.createHorizontalStrut(20);
	private final Component horizontalStrut_2 = Box.createHorizontalStrut(20);
	private final Component horizontalStrut_3 = Box.createHorizontalStrut(20);
	private final Component horizontalStrut_4 = Box.createHorizontalStrut(20);
	private final Component horizontalStrut_5 = Box.createHorizontalStrut(20);
	private final JLabel lblFondo = new JLabel("New label");
	private final JLabel lblTheSmarterTechnologies = new JLabel("The Smarter Technologies 2013");
	private String tipo;

	/**
	 * Create the frame.
	 */
	public VentanaPrincipal() {
		setResizable(false);
		setPreferredSize(new Dimension(660, 450));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 660, 450);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		pnlLogoPrincipal.setBackground(new Color(238, 238, 238));
		pnlLogoPrincipal.setPreferredSize(new Dimension(10, 100));
		
		contentPane.add(pnlLogoPrincipal, BorderLayout.NORTH);
		pnlLogoPrincipal.setLayout(null);
		lblLogoPrincipal.setBounds(6, 0, 438, 92);
		lblLogoPrincipal.setIcon(new ImageIcon(VentanaPrincipal.class.getResource("/org/Iter2/Recursos/logoPrincipal.png")));
		
		pnlLogoPrincipal.add(lblLogoPrincipal);
		
		contentPane.add(pnlSecciones, BorderLayout.CENTER);
		pnlSecciones.setLayout(null);
		verticalStrut.setBounds(0, 0, 0, 0);
		pnlSecciones.add(verticalStrut);
		horizontalStrut_5.setBounds(0, 0, 0, 0);
		pnlSecciones.add(horizontalStrut_5);
		btbBC.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btbBC.setBounds(18, 33, 615, 65);
		
		btbBC.setIcon(new ImageIcon(VentanaPrincipal.class.getResource("/org/Iter2/Recursos/logoPBC.png")));
		pnlSecciones.add(btbBC);
		horizontalStrut_3.setBounds(0, 0, 0, 0);
		pnlSecciones.add(horizontalStrut_3);
		horizontalStrut_1.setBounds(0, 0, 0, 0);
		pnlSecciones.add(horizontalStrut_1);
		horizontalStrut_4.setBounds(0, 0, 0, 0);
		pnlSecciones.add(horizontalStrut_4);
		btbD.setBounds(18, 137, 615, 65);
		btbD.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//Action
			}
		});
		btbD.setIcon(new ImageIcon(VentanaPrincipal.class.getResource("/org/Iter2/Recursos/logoPriD.png")));
		pnlSecciones.add(btbD);
		horizontalStrut_2.setBounds(0, 0, 0, 0);
		pnlSecciones.add(horizontalStrut_2);
		horizontalStrut.setBounds(0, 0, 0, 0);
		pnlSecciones.add(horizontalStrut);
		btbGestionarUsuarios.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
				VentanaGestorUsuarios vg=new VentanaGestorUsuarios();
				vg.mostrar(tipo);
			}
		});
		btbGestionarUsuarios.setVisible(false);
		btbGestionarUsuarios.setBounds(250, 238, 152, 29);
		pnlSecciones.add(btbGestionarUsuarios);
		lblFondo.setDoubleBuffered(true);
		lblFondo.setIcon(new ImageIcon(VentanaPrincipal.class.getResource("/org/Iter2/Recursos/fondo.png")));
		lblFondo.setBounds(0, 0, 672, 286);
		
		pnlSecciones.add(lblFondo);
		lblTheSmarterTechnologies.setBounds(435, 296, 209, 16);
		
		pnlSecciones.add(lblTheSmarterTechnologies);
	}
    public void mostrar(String admin)
    {
    	tipo=admin;
    	if(tipo.equalsIgnoreCase("administrador")){
    		btbGestionarUsuarios.setVisible(true);
    	}
    	
        setVisible(true);
    }
}
